import getTitle from './getTitle'
import voice from '../utils/voice' //导入语音
import Toast from '@vant/weapp/toast/toast';

function updateLcn(qqmapsdk) {
  qqmapsdk.reverseGeocoder({
    success: (res) => {
      const {
        lat,
        lng
      } = res.result.location;
      console.log(res.result.location);
      this.setData({
        latitude: lat,
        longitude: lng
      })
      let title = getTitle.getTitle(lat, lng)
      if (title == '') {
        voice.wordYun(`已定位当前区域`)
        Toast('已定位当前区域')
      } else {
        voice.wordYun(`您所在区域为：${title}`)
        Toast(title)
      }
    }
  })
}
export default {
  updateLcn
}